# ./script/runner ./jobs/import_last_hour.rb <id>

require 'tzinfo'
tz = TZInfo::Timezone.get("America/Los_Angeles")
local = tz.utc_to_local(66.minutes.ago.utc)

postings = Posting.load_new_since(local)
skipped, created = postings.partition { |posting| posting.new_record? }
results = [
  {
    :added => created.size,
    :skipped => skipped.size
  },
  created.map { |posting| {:title => posting.title, :created => posting.created_at } }
]

puts results.to_yaml